FROM gitea.dev.ng8877.com/niguang/maven:latest as builder
COPY . /work/
WORKDIR /work
RUN mvn package

FROM openjdk:8-jre
WORKDIR /
COPY --from=builder /work/target/gateway-0.0.1-SNAPSHOT.jar /
RUN mkdir /logs && chmod 777 /logs

ENV JAVA_OPTS="-Xms512m -Xmx512m -Duser.timezone=GMT+08 -Dreactor.netty.ioWorkerCount=6 -Dreactor.netty.ioSelectCount=6" \
    SPRING_PROFILES="dev" \
    PORT=8080 \
    TZ="Asia/Shanghai"

ENTRYPOINT java -jar ${JAVA_OPTS} /gateway-0.0.1-SNAPSHOT.jar --server.port=${PORT} --spring.profiles.active=${SPRING_PROFILES}